package com.hejia.alauda.persistence.mybatis;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.hejia.alauda.entity.Popularize;
import com.hejia.alauda.persistence.BaseMapper;

public interface PopularizeMapper extends BaseMapper<Popularize> {

	List<Popularize> selectByIds(Long[] array);

	/**
	 * 查询来源ID
	 * @param biggerCategoryId 大类ID
	 * @return
	 */
	@Select("select p.sourceId from popularize p join popularizecategory c on p.category_id = c.id where c.bigger_id = #{biggerCategoryId}")
	List<String> findSourceIdByBiggerCategoryId(@Param("biggerCategoryId") Long biggerCategoryId);

	/**
	 * 查询来源ID
	 * @param categoryId 类别ID
	 * @return
	 */
	@Select("select p.sourceId from popularize p join popularizecategory c on p.category_id = c.id where c.id = #{categoryId}")
	List<String> findSourceIdByCategoryId(@Param("categoryId") Long categoryId);

	/**
	 * 查询来源ID
	 * @param popularizeId 推广ID
	 * @return
	 */
	@Select("select p.sourceId from popularize p where p.id = #{popularizeId}")
	List<String> findSourceIdByPopularizeId(@Param("popularizeId") Long popularizeId);

}
